<template>
  <div id="app">
    <component :is="layout">
      <router-view />
    </component>
  </div>
</template>

<script>
export default {
  name: "App",
  provide() {
    return {
      reload: this.reload,
    };
  },
  data() {
    return {
      default_layout: "default", //设置layout
      isRouterAlive: true,
    };
  },
  computed: {
    layout() {
      return (this.$route.meta.layout || this.default_layout) + "-layout";
    },
  },
  methods: {
    //通过声明reload方法，控制router-view的显示或隐藏，从而控制页面的再次加载
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function () {
        this.isRouterAlive = true;
      });
    },
  },
};
</script>

<style>
body {
  padding: 0;
  margin: 0;
  font-size: 12px;
}
.container {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-left {
  text-align: left;
}
.el-main {
  color: #333;
  padding: 0;
  margin: 0;
  min-height: calc(100vh - 80px);
}
.el-card__body {
    padding: 10px 15px 15px 15px !important;
}
.th-title {
  border-left: 3px solid #409eff;
  padding-left: 5px;
  margin-top: 0;
}
.float-right {
  float: right;
}
.float-left {
  float: left;
}
.btn-link {
  color: inherit;
  text-decoration: none;
}
.clearfix::after {
    display: block;
    clear: both;
    content: "";
}
</style>
